#  This file is part of -_-.
#
#    -_- is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    -_- is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with -_-.  If not, see <http://www.gnu.org/licenses/>.
#
#    Copyright 2012 Oliver Katz

PACKAGES=directfb x11 IL ILU ILUT freetype2
INCLUDES=-I. -I/usr/include/llvm -I/usr/include/llvm/Analysis -I/usr/include/llvm/ExecutionEngine -I/usr/include/llvm/Support -ILU
LIBPATH=-L. -L../common -L../bus -L../vm -L../opal -L../visual -L../..
LIBS=-ldl -lGL -lGLU -lglut -lreadline

CC=gcc
CXX=g++
CFLAGS=-g -O2 --std=c99 -fPIC $(shell pkg-config --cflags $(PACKAGES)) $(INCLUDES)
CXXFLAGS=-g -O2 -std=c++11 -fPIC $(shell pkg-config --cflags $(PACKAGES)) $(INCLUDES) $(shell llvm-config --cppflags) -I/usr/include -DNDEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -fomit-frame-pointer
LDFLAGS=$(shell pkg-config --libs $(PACKAGES)) $(LIBPATH) $(LIBS)
LDXXFLAGS=$(shell pkg-config --libs $(PACKAGES)) $(LIBPATH) $(LIBS) $(shell llvm-config --ldflags --libs core jit native)
RM=rm
RMFLAGS=-f --
AR=ar
ARFLAGS=rcs
MK=make
MKFLAGS=

%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@

%.o : %.cpp
	$(CXX) $(CXXFLAGS) -c $< -o $@
